﻿using System;
using System.Collections;
using System.Collections.Generic;
using FBSAssist;
using IllusionUtility.GetUtility;
using IllusionUtility.SetUtility;
using Manager;
using UnityEngine;

// Token: 0x02000251 RID: 593
public abstract class CharBody : global::BaseLoader
{
	// Token: 0x170001B9 RID: 441
	// (get) Token: 0x06000D67 RID: 3431 RVA: 0x000605F0 File Offset: 0x0005E7F0
	// (set) Token: 0x06000D68 RID: 3432 RVA: 0x000605F8 File Offset: 0x0005E7F8
	public bool LoadEnd { get; set; }

	// Token: 0x170001BA RID: 442
	// (get) Token: 0x06000D69 RID: 3433 RVA: 0x00060604 File Offset: 0x0005E804
	// (set) Token: 0x06000D6A RID: 3434 RVA: 0x0006060C File Offset: 0x0005E80C
	public global::CharInfo chaInfo { get; set; }

	// Token: 0x170001BB RID: 443
	// (get) Token: 0x06000D6B RID: 3435 RVA: 0x00060618 File Offset: 0x0005E818
	// (set) Token: 0x06000D6C RID: 3436 RVA: 0x00060620 File Offset: 0x0005E820
	public global::CharFile chaFile { get; set; }

	// Token: 0x170001BC RID: 444
	// (get) Token: 0x06000D6D RID: 3437 RVA: 0x0006062C File Offset: 0x0005E82C
	// (set) Token: 0x06000D6E RID: 3438 RVA: 0x00060634 File Offset: 0x0005E834
	public global::CharFileInfoCustom customInfo { get; set; }

	// Token: 0x170001BD RID: 445
	// (get) Token: 0x06000D6F RID: 3439 RVA: 0x00060640 File Offset: 0x0005E840
	// (set) Token: 0x06000D70 RID: 3440 RVA: 0x00060648 File Offset: 0x0005E848
	public global::CharFileInfoStatus statusInfo { get; set; }

	// Token: 0x170001BE RID: 446
	// (get) Token: 0x06000D71 RID: 3441 RVA: 0x00060654 File Offset: 0x0005E854
	// (set) Token: 0x06000D72 RID: 3442 RVA: 0x0006065C File Offset: 0x0005E85C
	public global::CharFileInfoClothes clothesInfo { get; set; }

	// Token: 0x170001BF RID: 447
	// (get) Token: 0x06000D73 RID: 3443 RVA: 0x00060668 File Offset: 0x0005E868
	// (set) Token: 0x06000D74 RID: 3444 RVA: 0x00060670 File Offset: 0x0005E870
	public global::CharCustom charCustom { get; set; }

	// Token: 0x170001C0 RID: 448
	// (get) Token: 0x06000D75 RID: 3445 RVA: 0x0006067C File Offset: 0x0005E87C
	// (set) Token: 0x06000D76 RID: 3446 RVA: 0x00060684 File Offset: 0x0005E884
	public global::CharClothes charClothes { get; set; }

	// Token: 0x170001C1 RID: 449
	// (get) Token: 0x06000D77 RID: 3447 RVA: 0x00060690 File Offset: 0x0005E890
	// (set) Token: 0x06000D78 RID: 3448 RVA: 0x00060698 File Offset: 0x0005E898
	public Animator animBody { get; set; }

	// Token: 0x170001C2 RID: 450
	// (get) Token: 0x06000D79 RID: 3449 RVA: 0x000606A4 File Offset: 0x0005E8A4
	// (set) Token: 0x06000D7A RID: 3450 RVA: 0x000606AC File Offset: 0x0005E8AC
	public global::AnimeIKCtrl animIKCtrl { get; set; }

	// Token: 0x170001C3 RID: 451
	// (get) Token: 0x06000D7B RID: 3451 RVA: 0x000606B8 File Offset: 0x0005E8B8
	// (set) Token: 0x06000D7C RID: 3452 RVA: 0x000606C0 File Offset: 0x0005E8C0
	public global::NeckLookControllerVer2 neckLookCtrl { get; set; }

	// Token: 0x170001C4 RID: 452
	// (get) Token: 0x06000D7D RID: 3453 RVA: 0x000606CC File Offset: 0x0005E8CC
	// (set) Token: 0x06000D7E RID: 3454 RVA: 0x000606D4 File Offset: 0x0005E8D4
	public global::EyeLookController eyeLookCtrl { get; set; }

	// Token: 0x170001C5 RID: 453
	// (get) Token: 0x06000D7F RID: 3455 RVA: 0x000606E0 File Offset: 0x0005E8E0
	// (set) Token: 0x06000D80 RID: 3456 RVA: 0x000606E8 File Offset: 0x0005E8E8
	public global::FaceBlendShape fbsCtrl { get; set; }

	// Token: 0x170001C6 RID: 454
	// (get) Token: 0x06000D81 RID: 3457 RVA: 0x000606F4 File Offset: 0x0005E8F4
	// (set) Token: 0x06000D82 RID: 3458 RVA: 0x000606FC File Offset: 0x0005E8FC
	public global::FBSCtrlEyes eyesCtrl { get; set; }

	// Token: 0x170001C7 RID: 455
	// (get) Token: 0x06000D83 RID: 3459 RVA: 0x00060708 File Offset: 0x0005E908
	// (set) Token: 0x06000D84 RID: 3460 RVA: 0x00060710 File Offset: 0x0005E910
	public global::FBSCtrlMouth mouthCtrl { get; set; }

	// Token: 0x170001C8 RID: 456
	// (get) Token: 0x06000D85 RID: 3461 RVA: 0x0006071C File Offset: 0x0005E91C
	// (set) Token: 0x06000D86 RID: 3462 RVA: 0x00060724 File Offset: 0x0005E924
	public float voiceCorrectValue { get; set; }

	// Token: 0x170001C9 RID: 457
	// (get) Token: 0x06000D87 RID: 3463 RVA: 0x00060730 File Offset: 0x0005E930
	// (set) Token: 0x06000D88 RID: 3464 RVA: 0x00060738 File Offset: 0x0005E938
	public global::CharBody.IKObjectRefresh ikObjRefresh { get; set; }

	// Token: 0x170001CA RID: 458
	// (get) Token: 0x06000D89 RID: 3465 RVA: 0x00060744 File Offset: 0x0005E944
	// (set) Token: 0x06000D8A RID: 3466 RVA: 0x0006074C File Offset: 0x0005E94C
	public GameObject objTop { get; set; }

	// Token: 0x170001CB RID: 459
	// (get) Token: 0x06000D8B RID: 3467 RVA: 0x00060758 File Offset: 0x0005E958
	// (set) Token: 0x06000D8C RID: 3468 RVA: 0x00060760 File Offset: 0x0005E960
	public GameObject objAnim { get; set; }

	// Token: 0x170001CC RID: 460
	// (get) Token: 0x06000D8D RID: 3469 RVA: 0x0006076C File Offset: 0x0005E96C
	// (set) Token: 0x06000D8E RID: 3470 RVA: 0x00060774 File Offset: 0x0005E974
	public GameObject objBone { get; set; }

	// Token: 0x170001CD RID: 461
	// (get) Token: 0x06000D8F RID: 3471 RVA: 0x00060780 File Offset: 0x0005E980
	// (set) Token: 0x06000D90 RID: 3472 RVA: 0x00060788 File Offset: 0x0005E988
	public GameObject objBase { get; set; }

	// Token: 0x170001CE RID: 462
	// (get) Token: 0x06000D91 RID: 3473 RVA: 0x00060794 File Offset: 0x0005E994
	// (set) Token: 0x06000D92 RID: 3474 RVA: 0x0006079C File Offset: 0x0005E99C
	public GameObject objBody { get; set; }

	// Token: 0x170001CF RID: 463
	// (get) Token: 0x06000D93 RID: 3475 RVA: 0x000607A8 File Offset: 0x0005E9A8
	// (set) Token: 0x06000D94 RID: 3476 RVA: 0x000607B0 File Offset: 0x0005E9B0
	public GameObject objHeadBone { get; set; }

	// Token: 0x170001D0 RID: 464
	// (get) Token: 0x06000D95 RID: 3477 RVA: 0x000607BC File Offset: 0x0005E9BC
	// (set) Token: 0x06000D96 RID: 3478 RVA: 0x000607C4 File Offset: 0x0005E9C4
	public GameObject objHead { get; set; }

	// Token: 0x170001D1 RID: 465
	// (get) Token: 0x06000D97 RID: 3479 RVA: 0x000607D0 File Offset: 0x0005E9D0
	// (set) Token: 0x06000D98 RID: 3480 RVA: 0x000607D8 File Offset: 0x0005E9D8
	public global::ListTypeFbx infoHead { get; set; }

	// Token: 0x170001D2 RID: 466
	// (get) Token: 0x06000D99 RID: 3481 RVA: 0x000607E4 File Offset: 0x0005E9E4
	// (set) Token: 0x06000D9A RID: 3482 RVA: 0x000607EC File Offset: 0x0005E9EC
	public GameObject[] objHair
	{
		get
		{
			return this._objHair;
		}
		set
		{
			this._objHair = value;
		}
	}

	// Token: 0x170001D3 RID: 467
	// (get) Token: 0x06000D9B RID: 3483 RVA: 0x000607F8 File Offset: 0x0005E9F8
	// (set) Token: 0x06000D9C RID: 3484 RVA: 0x00060800 File Offset: 0x0005EA00
	public global::ListTypeFbx[] infoHair
	{
		get
		{
			return this._infoHair;
		}
		set
		{
			this._infoHair = value;
		}
	}

	// Token: 0x170001D4 RID: 468
	// (get) Token: 0x06000D9D RID: 3485 RVA: 0x0006080C File Offset: 0x0005EA0C
	// (set) Token: 0x06000D9E RID: 3486 RVA: 0x00060814 File Offset: 0x0005EA14
	public GameObject[] objClothes
	{
		get
		{
			return this._objClothes;
		}
		set
		{
			this._objClothes = value;
		}
	}

	// Token: 0x170001D5 RID: 469
	// (get) Token: 0x06000D9F RID: 3487 RVA: 0x00060820 File Offset: 0x0005EA20
	// (set) Token: 0x06000DA0 RID: 3488 RVA: 0x00060828 File Offset: 0x0005EA28
	public global::ListTypeFbx[] infoClothes
	{
		get
		{
			return this._infoClothes;
		}
		set
		{
			this._infoClothes = value;
		}
	}

	// Token: 0x170001D6 RID: 470
	// (get) Token: 0x06000DA1 RID: 3489 RVA: 0x00060834 File Offset: 0x0005EA34
	// (set) Token: 0x06000DA2 RID: 3490 RVA: 0x0006083C File Offset: 0x0005EA3C
	public GameObject[] objAccessory
	{
		get
		{
			return this._objAccessory;
		}
		set
		{
			this._objAccessory = value;
		}
	}

	// Token: 0x170001D7 RID: 471
	// (get) Token: 0x06000DA3 RID: 3491 RVA: 0x00060848 File Offset: 0x0005EA48
	// (set) Token: 0x06000DA4 RID: 3492 RVA: 0x00060850 File Offset: 0x0005EA50
	public global::ListTypeFbx[] infoAccessory
	{
		get
		{
			return this._infoAccessory;
		}
		set
		{
			this._infoAccessory = value;
		}
	}

	// Token: 0x170001D8 RID: 472
	// (get) Token: 0x06000DA5 RID: 3493 RVA: 0x0006085C File Offset: 0x0005EA5C
	// (set) Token: 0x06000DA6 RID: 3494 RVA: 0x00060864 File Offset: 0x0005EA64
	public GameObject[] objAcsMove
	{
		get
		{
			return this._objAcsMove;
		}
		set
		{
			this._objAcsMove = value;
		}
	}

	// Token: 0x170001D9 RID: 473
	// (get) Token: 0x06000DA7 RID: 3495 RVA: 0x00060870 File Offset: 0x0005EA70
	// (set) Token: 0x06000DA8 RID: 3496 RVA: 0x00060878 File Offset: 0x0005EA78
	public GameObject objHitBody { get; set; }

	// Token: 0x170001DA RID: 474
	// (get) Token: 0x06000DA9 RID: 3497 RVA: 0x00060884 File Offset: 0x0005EA84
	// (set) Token: 0x06000DAA RID: 3498 RVA: 0x0006088C File Offset: 0x0005EA8C
	public GameObject objHitHead { get; set; }

	// Token: 0x170001DB RID: 475
	// (get) Token: 0x06000DAB RID: 3499 RVA: 0x00060898 File Offset: 0x0005EA98
	// (set) Token: 0x06000DAC RID: 3500 RVA: 0x000608A0 File Offset: 0x0005EAA0
	public GameObject objMannequinHead { get; set; }

	// Token: 0x170001DC RID: 476
	// (get) Token: 0x06000DAD RID: 3501 RVA: 0x000608AC File Offset: 0x0005EAAC
	// (set) Token: 0x06000DAE RID: 3502 RVA: 0x000608B4 File Offset: 0x0005EAB4
	public global::Expression expression { get; set; }

	// Token: 0x170001DD RID: 477
	// (get) Token: 0x06000DAF RID: 3503 RVA: 0x000608C0 File Offset: 0x0005EAC0
	// (set) Token: 0x06000DB0 RID: 3504 RVA: 0x000608C8 File Offset: 0x0005EAC8
	public global::CustomTextureControl customTexCtrlFace { get; set; }

	// Token: 0x170001DE RID: 478
	// (get) Token: 0x06000DB1 RID: 3505 RVA: 0x000608D4 File Offset: 0x0005EAD4
	// (set) Token: 0x06000DB2 RID: 3506 RVA: 0x000608DC File Offset: 0x0005EADC
	public global::CustomTextureControl customTexCtrlBody { get; set; }

	// Token: 0x170001DF RID: 479
	// (get) Token: 0x06000DB3 RID: 3507 RVA: 0x000608E8 File Offset: 0x0005EAE8
	public Material customMatFace
	{
		get
		{
			return (this.customTexCtrlFace != null) ? this.customTexCtrlFace.matDraw : null;
		}
	}

	// Token: 0x170001E0 RID: 480
	// (get) Token: 0x06000DB4 RID: 3508 RVA: 0x00060908 File Offset: 0x0005EB08
	public Material customMatBody
	{
		get
		{
			return (this.customTexCtrlBody != null) ? this.customTexCtrlBody.matDraw : null;
		}
	}

	// Token: 0x06000DB5 RID: 3509 RVA: 0x00060928 File Offset: 0x0005EB28
	public bool InitBaseCustomTextureBody(byte _sex)
	{
		if (this.customTexCtrlBody != null)
		{
			this.customTexCtrlBody.Release();
			this.customTexCtrlBody = null;
		}
		string text = (_sex != 0) ? "chara/cf_m_base.unity3d" : "chara/cm_m_base.unity3d";
		string drawMatName = (_sex != 0) ? "cf_m_body" : "cm_m_body";
		string createMatName = (_sex != 0) ? "cf_m_body_create" : "cm_m_body_create";
		this.customTexCtrlBody = new global::CustomTextureControl();
		this.customTexCtrlBody.Initialize(text, drawMatName, text, createMatName, 1024, 1024);
		return true;
	}

	// Token: 0x06000DB6 RID: 3510 RVA: 0x000609BC File Offset: 0x0005EBBC
	public bool InitBaseCustomTextureFace(byte _sex, string drawAssetBundleName, string drawAssetName)
	{
		if (this.customTexCtrlFace != null)
		{
			this.customTexCtrlFace.Release();
			this.customTexCtrlFace = null;
		}
		string createMatABName = (_sex != 0) ? "chara/cf_m_base.unity3d" : "chara/cm_m_base.unity3d";
		string createMatName = (_sex != 0) ? "cf_m_face_create" : "cm_m_face_create";
		this.customTexCtrlFace = new global::CustomTextureControl();
		this.customTexCtrlFace.Initialize(drawAssetBundleName, drawAssetName, createMatABName, createMatName, 1024, 1024);
		return true;
	}

	// Token: 0x06000DB7 RID: 3511 RVA: 0x00060A38 File Offset: 0x0005EC38
	public void Init(global::CharInfo info)
	{
		this.chaInfo = info;
		this.chaFile = this.chaInfo.chaFile;
		this.customInfo = this.chaInfo.customInfo;
		this.statusInfo = this.chaInfo.statusInfo;
		this.clothesInfo = this.chaInfo.clothesInfo;
		this.charCustom = null;
		this.charClothes = null;
		this.LoadEnd = false;
		this.animBody = null;
		this.ikObjRefresh = null;
		this.neckLookCtrl = null;
		this.eyeLookCtrl = null;
		this.fbsCtrl = null;
		this.eyesCtrl = null;
		this.mouthCtrl = null;
		this.asVoice = null;
		this.voiceCorrectValue = -1f;
		this.objTop = null;
		this.objAnim = null;
		this.objBone = null;
		this.objBase = null;
		this.objBody = null;
		this.objHeadBone = null;
		this.objHead = null;
		this.infoHead = null;
		this.objHair = new GameObject[this.customInfo.hairKindNum];
		this.infoHair = new global::ListTypeFbx[this.customInfo.hairKindNum];
		this.objClothes = new GameObject[this.clothesInfo.clothesKindNum];
		this.infoClothes = new global::ListTypeFbx[this.clothesInfo.clothesKindNum];
		this.objAccessory = new GameObject[10];
		this.infoAccessory = new global::ListTypeFbx[10];
		this.objAcsMove = new GameObject[10];
		this.objMannequinHead = null;
		this.mannequinMode = false;
		this.expression = null;
	}

	// Token: 0x06000DB8 RID: 3512 RVA: 0x00060BB4 File Offset: 0x0005EDB4
	public GameObject LoadCharaFbxData(Type type, int typeNo, int id, string createName, bool copyDynamicBone, byte copyWeights, Transform trfParent, int defaultId, bool worldPositionStays = false)
	{
		GameObject actObj = null;
		base.StartCoroutine(this.LoadCharaFbxDataAsync(delegate(GameObject o)
		{
			actObj = o;
		}, type, typeNo, id, createName, copyDynamicBone, copyWeights, trfParent, defaultId, false, worldPositionStays));
		return actObj;
	}

	// Token: 0x06000DB9 RID: 3513 RVA: 0x00060C00 File Offset: 0x0005EE00
	public IEnumerator LoadCharaFbxDataAsync(Action<GameObject> actObj, Type type, int typeNo, int id, string createName, bool copyDynamicBone, byte copyWeights, Transform trfParent, int defaultId, bool AsyncFlags = true, bool worldPositionStays = false)
	{
		byte loadKind = 0;
		Dictionary<int, global::ListTypeFbx> work = null;
		if (type == typeof(global::CharaListInfo.TypeMaleFbx))
		{
			loadKind = 0;
		}
		else if (type == typeof(global::CharaListInfo.TypeFemaleFbx))
		{
			loadKind = 1;
		}
		else
		{
			if (type != typeof(global::CharaListInfo.TypeAccessoryFbx))
			{
				yield break;
			}
			loadKind = 2;
		}
		if (loadKind == 0)
		{
			work = this.chaInfo.ListInfo.GetMaleFbxList((global::CharaListInfo.TypeMaleFbx)typeNo, true);
		}
		else if (loadKind == 1)
		{
			work = this.chaInfo.ListInfo.GetFemaleFbxList((global::CharaListInfo.TypeFemaleFbx)typeNo, true);
		}
		else
		{
			work = this.chaInfo.ListInfo.GetAccessoryFbxList((global::CharaListInfo.TypeAccessoryFbx)typeNo, true);
		}
		if (work.Count == 0)
		{
			actObj(null);
			yield break;
		}
		bool reCheck = false;
		global::ListTypeFbx ltf = null;
		if (work.TryGetValue(id, out ltf))
		{
			bool skipCheck = false;
			if (this.chaInfo.customInfo.isConcierge)
			{
				skipCheck = global::CharaListInfo.CheckSitriClothesID(ltf.Category, ltf.Id);
			}
			if (!skipCheck && global::CharaListInfo.CheckCustomID(ltf.Category, ltf.Id) == 0)
			{
				reCheck = true;
			}
		}
		else
		{
			reCheck = true;
		}
		if (reCheck)
		{
			if (loadKind == 2)
			{
				yield break;
			}
			id = defaultId;
			work.TryGetValue(id, out ltf);
			if (ltf == null && !work.TryGetValue(0, out ltf))
			{
				actObj(null);
				yield break;
			}
		}
		if (this.chaInfo.Sex == 0)
		{
			if (string.Empty == ltf.PrefabM)
			{
				yield break;
			}
		}
		else if (string.Empty == ltf.PrefabF)
		{
			yield break;
		}
		string assetName = (this.chaInfo.Sex != 0) ? ltf.PrefabF : ltf.PrefabM;
		GameObject newObj = null;
		if (AsyncFlags)
		{
			yield return base.StartCoroutine(base.Load_Coroutine<GameObject>(ltf.ABPath, assetName, delegate(GameObject x)
			{
				newObj = x;
			}, true, false, null));
		}
		else
		{
			newObj = global::CommonLib.LoadAsset<GameObject>(ltf.ABPath, assetName, true, ltf.Manifest);
		}
		global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(ltf.ABPath);
		if (null == newObj)
		{
			actObj(null);
			yield break;
		}
		newObj.name = createName;
		if (trfParent)
		{
			newObj.transform.SetParent(trfParent, worldPositionStays);
		}
		global::DynamicBoneCollider[] collider = this.objBone.GetComponentsInChildren<global::DynamicBoneCollider>(true);
		Dictionary<string, GameObject> dictBone = this.aaWeightsBody.dictBone;
		global::DynamicBone[] db = newObj.GetComponentsInChildren<global::DynamicBone>(true);
		foreach (global::DynamicBone d in db)
		{
			if (copyDynamicBone)
			{
				if (d.m_Root)
				{
					foreach (KeyValuePair<string, GameObject> bone in dictBone)
					{
						if (!(bone.Key != d.m_Root.name))
						{
							d.m_Root = bone.Value.transform;
							break;
						}
					}
				}
				if (d.m_Exclusions != null && d.m_Exclusions.Count != 0)
				{
					for (int i = 0; i < d.m_Exclusions.Count; i++)
					{
						if (!(null == d.m_Exclusions[i]))
						{
							foreach (KeyValuePair<string, GameObject> bone2 in dictBone)
							{
								if (!(bone2.Key != d.m_Exclusions[i].name))
								{
									d.m_Exclusions[i] = bone2.Value.transform;
									break;
								}
							}
						}
					}
				}
				if (d.m_notRolls != null && d.m_notRolls.Count != 0)
				{
					for (int j = 0; j < d.m_notRolls.Count; j++)
					{
						if (!(null == d.m_notRolls[j]))
						{
							foreach (KeyValuePair<string, GameObject> bone3 in dictBone)
							{
								if (!(bone3.Key != d.m_notRolls[j].name))
								{
									d.m_notRolls[j] = bone3.Value.transform;
									break;
								}
							}
						}
					}
				}
			}
			if (d.m_Colliders != null)
			{
				d.m_Colliders.Clear();
				for (int k = 0; k < collider.Length; k++)
				{
					d.m_Colliders.Add(collider[k]);
				}
			}
		}
		if (copyWeights == 1)
		{
			GameObject objRootBone = this.chaInfo.GetReferenceInfo(global::CharReference.RefObjKey.A_ROOTBONE);
			Transform trfRootBone = (!objRootBone) ? null : objRootBone.transform;
			this.aaWeightsBody.AssignedWeights(newObj, this.deleteBodyBoneName, trfRootBone);
		}
		else if (copyWeights == 2)
		{
			this.aaWeightsHead.AssignedWeights(newObj, this.deleteHeadBoneName, null);
		}
		global::ListTypeFbxComponent ltfComponent = newObj.AddComponent<global::ListTypeFbxComponent>();
		ltfComponent.ltfData = ltf.Clone();
		actObj(newObj);
		if (AsyncFlags)
		{
			yield return null;
		}
		yield break;
	}

	// Token: 0x06000DBA RID: 3514 RVA: 0x00060CC8 File Offset: 0x0005EEC8
	public void ChangeAccessory(bool forceChange = false)
	{
		for (int i = 0; i < 10; i++)
		{
			base.StartCoroutine(this.ChangeAccessoryAsync(i, this.clothesInfo.accessory[i].type, this.clothesInfo.accessory[i].id, this.clothesInfo.accessory[i].parentKey, forceChange, false));
		}
	}

	// Token: 0x06000DBB RID: 3515 RVA: 0x00060D30 File Offset: 0x0005EF30
	public void ChangeAccessory(int _slotNo, int _acsType, int _acsId, string parentKey, bool forceChange = false)
	{
		base.StartCoroutine(this.ChangeAccessoryAsync(_slotNo, _acsType, _acsId, parentKey, forceChange, false));
	}

	// Token: 0x06000DBC RID: 3516 RVA: 0x00060D48 File Offset: 0x0005EF48
	public IEnumerator ChangeAccessoryAsync(bool forceChange = false)
	{
		for (int i = 0; i < 10; i++)
		{
			yield return base.StartCoroutine(this.ChangeAccessoryAsync(i, this.clothesInfo.accessory[i].type, this.clothesInfo.accessory[i].id, this.clothesInfo.accessory[i].parentKey, forceChange, true));
		}
		yield return null;
		yield break;
	}

	// Token: 0x06000DBD RID: 3517 RVA: 0x00060D74 File Offset: 0x0005EF74
	public IEnumerator ChangeAccessoryAsync(int _slotNo, int _acsType, int _acsId, string parentKey, bool forceChange = false, bool asyncFlags = true)
	{
		ulong[] tagFlags = new ulong[]
		{
			20UL,
			21UL,
			22UL,
			23UL,
			24UL,
			25UL,
			26UL,
			27UL,
			28UL,
			29UL
		};
		if (!global::MathfEx.RangeEqualOn(0, _slotNo, 9))
		{
			yield break;
		}
		global::ListTypeFbx ltf = null;
		bool load = true;
		bool release = true;
		int typeNum = Enum.GetNames(typeof(global::CharaListInfo.TypeAccessoryFbx)).Length;
		if (_acsType == -1 || !global::MathfEx.RangeEqualOn(0, _acsType, typeNum - 1))
		{
			release = true;
			load = false;
		}
		else
		{
			if (_acsId == -1)
			{
				release = false;
				load = false;
			}
			if (!forceChange && null != this.objAccessory[_slotNo] && _acsType == this.clothesInfo.accessory[_slotNo].type && _acsId == this.clothesInfo.accessory[_slotNo].id)
			{
				load = false;
				release = false;
			}
			if (_acsId != -1)
			{
				Dictionary<int, global::ListTypeFbx> work = this.chaInfo.ListInfo.GetAccessoryFbxList((global::CharaListInfo.TypeAccessoryFbx)_acsType, true);
				if (work == null)
				{
					release = true;
					load = false;
				}
				else if (!work.TryGetValue(_acsId, out ltf))
				{
					release = true;
					load = false;
				}
			}
		}
		if (release)
		{
			if (!load)
			{
				this.clothesInfo.accessory[_slotNo].MemberInitialize();
			}
			if (this.objAccessory[_slotNo])
			{
				UnityEngine.Object.Destroy(this.objAccessory[_slotNo]);
				this.objAccessory[_slotNo] = null;
				this.infoAccessory[_slotNo] = null;
				this.chaInfo.ReleaseTagObject(tagFlags[_slotNo]);
				this.objAcsMove[_slotNo] = null;
			}
		}
		if (load)
		{
			if (asyncFlags)
			{
				yield return null;
			}
			byte weight = 0;
			Transform trfParent = null;
			if ("0" == ltf.Parent)
			{
				weight = 2;
				trfParent = this.objTop.transform;
			}
			if (asyncFlags)
			{
				IEnumerator cor = this.LoadCharaFbxDataAsync(delegate(GameObject o)
				{
					this.objAccessory[_slotNo] = o;
				}, typeof(global::CharaListInfo.TypeAccessoryFbx), _acsType, _acsId, "ca_slot" + _slotNo.ToString("00"), false, weight, trfParent, 0, true, false);
				yield return base.StartCoroutine(cor);
			}
			else
			{
				this.objAccessory[_slotNo] = this.LoadCharaFbxData(typeof(global::CharaListInfo.TypeAccessoryFbx), _acsType, _acsId, "ca_slot" + _slotNo.ToString("00"), false, weight, trfParent, 0, false);
			}
			if (asyncFlags)
			{
				yield return null;
			}
			if (this.objAccessory[_slotNo])
			{
				global::ListTypeFbxComponent ltfComponent = this.objAccessory[_slotNo].GetComponent<global::ListTypeFbxComponent>();
				ltf = (this.infoAccessory[_slotNo] = ltfComponent.ltfData);
				this.clothesInfo.accessory[_slotNo].type = _acsType;
				this.clothesInfo.accessory[_slotNo].id = ltf.Id;
				this.objAcsMove[_slotNo] = this.objAccessory[_slotNo].transform.FindLoop("N_move");
				this.chaInfo.CreateTagInfo(tagFlags[_slotNo], this.objAccessory[_slotNo]);
			}
			else
			{
				this.clothesInfo.accessory[_slotNo].type = -1;
				this.clothesInfo.accessory[_slotNo].id = 0;
			}
		}
		if (this.objAccessory[_slotNo])
		{
			this.charClothes.ChangeAccessoryColor(_slotNo);
			if (string.Empty == parentKey)
			{
				parentKey = ltf.Parent;
			}
			this.charClothes.ChangeAccessoryParent(_slotNo, parentKey);
			this.charClothes.UpdateAccessoryMoveFromInfo(_slotNo);
		}
		if (asyncFlags)
		{
			yield return null;
		}
		yield break;
	}

	// Token: 0x06000DBE RID: 3518 RVA: 0x00060DEC File Offset: 0x0005EFEC
	public void ReleaseHitObject()
	{
		if (this.objHitBody)
		{
			global::SkinnedCollisionHelper[] componentsInChildren = this.objHitBody.GetComponentsInChildren<global::SkinnedCollisionHelper>(true);
			foreach (global::SkinnedCollisionHelper skinnedCollisionHelper in componentsInChildren)
			{
				skinnedCollisionHelper.Release();
			}
			UnityEngine.Object.Destroy(this.objHitBody);
			this.objHitBody = null;
		}
		if (this.objHitHead)
		{
			global::SkinnedCollisionHelper[] componentsInChildren2 = this.objHitHead.GetComponentsInChildren<global::SkinnedCollisionHelper>(true);
			foreach (global::SkinnedCollisionHelper skinnedCollisionHelper2 in componentsInChildren2)
			{
				skinnedCollisionHelper2.Release();
			}
			UnityEngine.Object.Destroy(this.objHitHead);
			this.objHitHead = null;
		}
	}

	// Token: 0x06000DBF RID: 3519 RVA: 0x00060EA8 File Offset: 0x0005F0A8
	public void LoadHitObject()
	{
		this.ReleaseHitObject();
		string assetBundleName = (this.chaInfo.Sex != 0) ? "chara/cf_base.unity3d" : "chara/cm_base.unity3d";
		string assetName = (this.chaInfo.Sex != 0) ? "p_hit_f_body" : "p_hit_m_body";
		this.objHitBody = global::CommonLib.LoadAsset<GameObject>(assetBundleName, assetName, true, string.Empty);
		global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(assetBundleName);
		if (this.objHitBody)
		{
			this.objHitBody.transform.SetParent(this.objTop.transform, false);
			this.aaWeightsBody.AssignedWeights(this.objHitBody, this.deleteBodyBoneName, null);
			global::SkinnedCollisionHelper[] componentsInChildren = this.objHitBody.GetComponentsInChildren<global::SkinnedCollisionHelper>(true);
			foreach (global::SkinnedCollisionHelper skinnedCollisionHelper in componentsInChildren)
			{
				skinnedCollisionHelper.Init();
			}
		}
		if (this.chaInfo.Sex != 0)
		{
			Dictionary<int, global::ListTypeFbx> femaleFbxList = this.chaInfo.ListInfo.GetFemaleFbxList(global::CharaListInfo.TypeFemaleFbx.cf_f_head, true);
			global::ListTypeFbx listTypeFbx = null;
			if (femaleFbxList.TryGetValue(this.customInfo.headId, out listTypeFbx))
			{
				assetName = listTypeFbx.PrefabF + "_hit";
				this.objHitHead = global::CommonLib.LoadAsset<GameObject>(listTypeFbx.ABPath, assetName, true, string.Empty);
				global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(listTypeFbx.ABPath);
				if (this.objHitHead)
				{
					this.objHitHead.transform.SetParent(this.objTop.transform, false);
					this.aaWeightsHead.AssignedWeights(this.objHitHead, this.deleteHeadBoneName, null);
					global::SkinnedCollisionHelper[] componentsInChildren2 = this.objHitHead.GetComponentsInChildren<global::SkinnedCollisionHelper>(true);
					foreach (global::SkinnedCollisionHelper skinnedCollisionHelper2 in componentsInChildren2)
					{
						skinnedCollisionHelper2.Init();
					}
				}
			}
		}
	}

	// Token: 0x06000DC0 RID: 3520 RVA: 0x00061090 File Offset: 0x0005F290
	public RuntimeAnimatorController LoadAnimation(string assetBundleName, string assetName)
	{
		if (null == this.animBody)
		{
			return null;
		}
		RuntimeAnimatorController runtimeAnimatorController = global::CommonLib.LoadAsset<RuntimeAnimatorController>(assetBundleName, assetName, false, string.Empty);
		if (null == runtimeAnimatorController)
		{
			return null;
		}
		this.animBody.runtimeAnimatorController = runtimeAnimatorController;
		global::AssetBundleManager.UnloadAssetBundle(assetBundleName, true, null);
		return runtimeAnimatorController;
	}

	// Token: 0x06000DC1 RID: 3521 RVA: 0x000610E4 File Offset: 0x0005F2E4
	public bool loadAnimeIKCtrlList(string _strAssetPath, string _strResourcePath, bool _bSetIK = true, bool _direct = false)
	{
		if (this.animIKCtrl == null)
		{
			return false;
		}
		this.animIKCtrl.Init();
		return this.animIKCtrl.LoadExcelData(_strAssetPath, _strResourcePath, _bSetIK, _direct);
	}

	// Token: 0x06000DC2 RID: 3522 RVA: 0x00061114 File Offset: 0x0005F314
	public void MozInit(string[] mozObjName)
	{
		this.lstMoz.Clear();
		for (int i = 0; i < mozObjName.Length; i++)
		{
			GameObject gameObject = this.objBase.transform.FindLoop(mozObjName[i]);
			if (!(null == gameObject))
			{
				this.lstMoz.Add(gameObject);
			}
		}
		Texture[] array = new Texture[4];
		string assetBundleName = "chara/etc.unity3d";
		for (int j = 0; j < array.Length; j++)
		{
			array[j] = global::CommonLib.LoadAsset<Texture>(assetBundleName, "cf_t_mnpb_00_" + j.ToString("00"), false, string.Empty);
		}
		global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(assetBundleName);
		foreach (GameObject gameObject2 in this.lstMoz)
		{
			global::ChangePtnAnime changePtnAnime = gameObject2.AddComponent<global::ChangePtnAnime>();
			changePtnAnime.Init(array);
		}
	}

	// Token: 0x06000DC3 RID: 3523 RVA: 0x00061224 File Offset: 0x0005F424
	public void ResetDynamicBone()
	{
		global::DynamicBone[] componentsInChildren = this.objTop.GetComponentsInChildren<global::DynamicBone>(true);
		foreach (global::DynamicBone dynamicBone in componentsInChildren)
		{
			dynamicBone.ResetParticlesPosition();
		}
	}

	// Token: 0x06000DC4 RID: 3524 RVA: 0x00061260 File Offset: 0x0005F460
	public bool SetVoice(Transform trfVoice)
	{
		if (null == trfVoice)
		{
			this.asVoice = null;
			return false;
		}
		this.asVoice = trfVoice.GetComponent<AudioSource>();
		return !(null == this.asVoice);
	}

	// Token: 0x06000DC5 RID: 3525 RVA: 0x00061298 File Offset: 0x0005F498
	public void UpdateBlendShapeVoice()
	{
		float voiceVaule = 0f;
		if (this.asVoice && this.asVoice.isPlaying)
		{
			if (this.chaInfo.Sex != 0)
			{
				if (0f > this.voiceCorrectValue)
				{
					global::PersonalityIdInfo personalityInfo = this.chaInfo.ListInfo.GetPersonalityInfo(this.customInfo.personality);
					this.voiceCorrectValue = personalityInfo.voiceCorrect;
				}
			}
			else
			{
				this.voiceCorrectValue = 3f;
			}
			voiceVaule = this.fbsaaVoice.GetAudioWaveValue(this.asVoice, 1, this.voiceCorrectValue);
		}
		if (this.fbsCtrl)
		{
			this.fbsCtrl.SetVoiceVaule(voiceVaule);
		}
	}

	// Token: 0x06000DC6 RID: 3526 RVA: 0x00061358 File Offset: 0x0005F558
	public void OnDestroy()
	{
		if (this.customTexCtrlFace != null)
		{
			this.customTexCtrlFace.Release();
		}
		if (this.customTexCtrlBody != null)
		{
			this.customTexCtrlBody.Release();
		}
		this.Release();
		Resources.UnloadUnusedAssets();
		GC.Collect();
	}

	// Token: 0x06000DC7 RID: 3527 RVA: 0x00061398 File Offset: 0x0005F598
	public void Release()
	{
		if (this.objTop)
		{
			UnityEngine.Object.Destroy(this.objTop);
		}
		if (this.animIKCtrl)
		{
			this.animIKCtrl.Release();
		}
		this.animIKCtrl = null;
		this.chaInfo.ReleaseRefAll();
		this.chaInfo.ReleaseTagAll();
		this.charCustom.ReleaseShapeBody();
		this.charCustom.ReleaseShapeFace();
		this.ReleaseSub();
		this.LoadEnd = false;
		this.animBody = null;
		this.ikObjRefresh = null;
		if (this.aaWeightsBody != null)
		{
			this.aaWeightsBody.Release();
		}
		if (this.aaWeightsHead != null)
		{
			this.aaWeightsHead.Release();
		}
		this.neckLookCtrl = null;
		this.eyeLookCtrl = null;
		this.fbsCtrl = null;
		this.eyesCtrl = null;
		this.mouthCtrl = null;
		this.objTop = null;
		this.objAnim = null;
		this.objBone = null;
		this.objBase = null;
		this.objBody = null;
		this.objHeadBone = null;
		this.objHead = null;
		this.infoHead = null;
		for (int i = 0; i < this.customInfo.hairKindNum; i++)
		{
			this.objHair[i] = null;
			this.infoHair[i] = null;
		}
		for (int j = 0; j < this.clothesInfo.clothesKindNum; j++)
		{
			this.objClothes[j] = null;
			this.infoClothes[j] = null;
		}
		this.objHitBody = null;
		this.objHitHead = null;
		this.expression = null;
		this.lstMoz.Clear();
		for (int k = 0; k < this.objAccessory.Length; k++)
		{
			this.objAccessory[k] = null;
			this.objAcsMove[k] = null;
			this.infoAccessory[k] = null;
		}
		this.objMannequinHead = null;
		this.mannequinMode = false;
		this.updateShapeBody = true;
		this.updateShapeFace = true;
	}

	// Token: 0x06000DC8 RID: 3528
	public abstract void ReleaseSub();

	// Token: 0x06000DC9 RID: 3529 RVA: 0x0006157C File Offset: 0x0005F77C
	public void ForceUpdate()
	{
		if (!this.LoadEnd)
		{
			return;
		}
		this.UpdateVisible();
		this.UpdateBlendShapeVoice();
		this.UpdateSub();
	}

	// Token: 0x06000DCA RID: 3530 RVA: 0x0006159C File Offset: 0x0005F79C
	public void Update()
	{
		this.ForceUpdate();
	}

	// Token: 0x06000DCB RID: 3531 RVA: 0x000615A4 File Offset: 0x0005F7A4
	public void ForceLateUpdate()
	{
		if (!this.LoadEnd)
		{
			return;
		}
		if (this.updateShapeFace)
		{
			this.charCustom.UpdateShapeFace();
			this.updateShapeFace = false;
		}
		if (this.updateShapeBody)
		{
			this.charCustom.UpdateShapeBody();
			this.updateShapeBody = false;
		}
		this.LateUpdateSub();
		if (this.resetDynamicBone)
		{
			this.ResetDynamicBone();
			this.resetDynamicBone = false;
		}
		if (this.objHeadBone)
		{
			GameObject referenceInfo = this.chaInfo.GetReferenceInfo(global::CharReference.RefObjKey.F_ADJUSTWIDTHSCALE);
			if (null != referenceInfo)
			{
				float x = 1f;
				if (this.mouthCtrl != null)
				{
					x = this.mouthCtrl.GetAdjustWidthScale();
				}
				referenceInfo.transform.SetLocalScaleX(x);
			}
		}
	}

	// Token: 0x06000DCC RID: 3532 RVA: 0x0006166C File Offset: 0x0005F86C
	public void LateUpdate()
	{
		if (!this.LoadEnd)
		{
			return;
		}
		this.ForceLateUpdate();
	}

	// Token: 0x06000DCD RID: 3533
	public abstract void UpdateVisible();

	// Token: 0x06000DCE RID: 3534
	public abstract void UpdateSub();

	// Token: 0x06000DCF RID: 3535
	public abstract void LateUpdateSub();

	// Token: 0x04000E7D RID: 3709
	public string deleteBodyBoneName = string.Empty;

	// Token: 0x04000E7E RID: 3710
	public string deleteHeadBoneName = string.Empty;

	// Token: 0x04000E7F RID: 3711
	public bool updateShapeFace;

	// Token: 0x04000E80 RID: 3712
	public bool updateShapeBody;

	// Token: 0x04000E81 RID: 3713
	public bool resetDynamicBone;

	// Token: 0x04000E82 RID: 3714
	public global::AssignedAnotherWeights aaWeightsBody = new global::AssignedAnotherWeights();

	// Token: 0x04000E83 RID: 3715
	public global::AssignedAnotherWeights aaWeightsHead = new global::AssignedAnotherWeights();

	// Token: 0x04000E84 RID: 3716
	public AudioSource asVoice;

	// Token: 0x04000E85 RID: 3717
	public FBSAssist.AudioAssist fbsaaVoice = new FBSAssist.AudioAssist();

	// Token: 0x04000E86 RID: 3718
	public GameObject[] _objHair;

	// Token: 0x04000E87 RID: 3719
	public global::ListTypeFbx[] _infoHair;

	// Token: 0x04000E88 RID: 3720
	public GameObject[] _objClothes;

	// Token: 0x04000E89 RID: 3721
	public global::ListTypeFbx[] _infoClothes;

	// Token: 0x04000E8A RID: 3722
	public GameObject[] _objAccessory;

	// Token: 0x04000E8B RID: 3723
	public global::ListTypeFbx[] _infoAccessory;

	// Token: 0x04000E8C RID: 3724
	public GameObject[] _objAcsMove;

	// Token: 0x04000E8D RID: 3725
	public List<GameObject> lstMoz = new List<GameObject>();

	// Token: 0x04000E8E RID: 3726
	public bool mannequinMode;

	// Token: 0x02000252 RID: 594
	public class IKObjectRefresh
	{
		// Token: 0x06000DD1 RID: 3537 RVA: 0x00061694 File Offset: 0x0005F894
		public void CreateInfo(GameObject _objAnim, string prefix)
		{
			this.lstIKObj.Clear();
			_objAnim.transform.FindLoopPrefix(this.lstIKObj, prefix);
		}

		// Token: 0x06000DD2 RID: 3538 RVA: 0x000616B4 File Offset: 0x0005F8B4
		public void Refresh()
		{
			List<GameObject> list = new List<GameObject>();
			string name = string.Empty;
			foreach (GameObject gameObject in this.lstIKObj)
			{
				Transform parent = gameObject.transform.parent;
				name = gameObject.name;
				gameObject.name = "delete";
				gameObject.transform.SetParent(null);
				UnityEngine.Object.Destroy(gameObject);
				GameObject gameObject2 = new GameObject(name);
				gameObject2.transform.SetParent(parent, true);
				list.Add(gameObject2);
			}
			this.lstIKObj = list;
		}

		// Token: 0x04000EAE RID: 3758
		public List<GameObject> lstIKObj = new List<GameObject>();
	}
}
